package thread;

import java.util.Scanner;

//sleep阻塞
//线程提供了一个静态的方法
//RUNNABLE状态继续并发运行
public class SleepDemo {
    public static void main(String[] args) {

        Scanner scanner=new Scanner(System.in);
            try {
                System.out.println("请输入倒计时启始数：");
                int i1=scanner.nextInt();
                System.out.println("开始执行倒计时");
                for (int i = i1; i >=1; i--) {
                    Thread.sleep(1000);
                    System.out.println("倒计时"+i);
                }
                System.out.println("倒计时完毕");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

    }
}
